package seed_commerce

import (
	"fmt"
	"gitee.com/theegg/go-brick/app/model/commerce/goods_set"
	"github.com/xormplus/xorm"
)

func InitGoodsSetSeed(db *xorm.Engine) {
	items := make(map[int]goods_set.GoodsSet)
	items[1] = goods_set.GoodsSet{
		MerchantId:  1,
		CatId:       1,
		BrandId:     1,
		Title:       "苹果IPHONE12",
		Description: "苹果IPHONE12, 最新系列",
		Status:      1,
	}

	count := 0
	errCount := 0
	for _, item := range items {
		_, err := db.Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	fmt.Printf("%5s|%25s|%10d|%8d|\n", "", "goods_set", count, errCount)
}
